<html><head><title>GetGadgetItemState</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">GetGadgetItemState()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>GetGadgetItemState</b></font>(#Gadget, Item)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Returns the item state of the specified gadget. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
The gadget to use. 

</td></tr>
<tr><td><i>Item</i></td>
<td> 
The item to get the state. The first item in the gadget has index 0. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns the state of the gadget item or 0 if there is an error. 
See below for the meaning of this value depending on the gadget type. 

</blockquote><p><b>Remarks</b></p><blockquote>

This is a universal function that works for almost all gadgets which handle several items: 
<br>
- <a href="calendargadget.html">CalendarGadget()</a>: returns <font color="#924B72">#PB_Calendar_Bold</font> when the specified date is displayed bold, 
<font color="#924B72">#PB_Calendar_Normal</font> otherwise. 
'Item' must be a PureBasic <a href="../date/index.html">date</a> value. 
<br>
- <a href="explorerlistgadget.html">ExplorerListGadget()</a>: returns a combination of the following values 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Explorer_File</font>      : The item is a file.
  <font color="#924B72">#PB_Explorer_Directory</font> : The item is a Directory (or drive).
  <font color="#924B72">#PB_Explorer_Selected</font>  : The item is currently selected.
</font></pre>
- <a href="listviewgadget.html">ListViewGadget()</a>: returns 1 if the item is selected, 0 otherwise. 
<br>
- <a href="listicongadget.html">ListIconGadget()</a>: returns a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_ListIcon_Selected</font> : The item is selected.
  <font color="#924B72">#PB_ListIcon_Checked</font>  : The item has its checkbox checked (<font color="#924B72">#PB_ListIcon_CheckBoxes</font> flag).
  <font color="#924B72">#PB_ListIcon_Inbetween</font>: The item's checkbox is in the &quot;in between&quot; state (<font color="#924B72">#PB_ListIcon_ThreeState</font> flag).
</font></pre>
- <a href="treegadget.html">TreeGadget()</a>: returns a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Tree_Selected</font> : The item is selected, 0 otherwise.
  <font color="#924B72">#PB_Tree_Expanded</font> : The item is expanded (a tree branch opened).
  <font color="#924B72">#PB_Tree_Collapsed</font>: The item is collapsed (the tree branch closed).
  <font color="#924B72">#PB_Tree_Checked</font>  : The Checkbox of the item is checked (<font color="#924B72">#PB_Tree_CheckBoxes</font> flag).
  <font color="#924B72">#PB_Tree_Inbetween</font>: The Checkbox of the item is in the &quot;in between&quot; state (<font color="#924B72">#PB_Tree_ThreeState</font> flag)
</font></pre>
Check for these states like this: 
<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> Result &amp; <font color="#924B72">#PB_Tree_Checked</font>
    <font color="#3A3966">; Item is checked</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>Example</b></p><blockquote>

Below an example with the <a href="listicongadget.html">ListIconGadget()</a>, how you can check 
for a combination of several results: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; ... here a code snippet from a WaitWindowEvent() - event loop:</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">GetGadgetItemState</font>(<font color="#924B72">#Listicon</font>, n) &amp; <font color="#924B72">#PB_ListIcon_Checked</font>
    <font color="#3A3966">; Item n is checked (no matter if selected)</font>
  <b><font color="#3A3966">EndIf</font></b>

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">GetGadgetItemState</font>(<font color="#924B72">#Listicon</font>, n) &amp; <font color="#924B72">#PB_ListIcon_Selected</font>
    <font color="#3A3966">; Item n is selected (no matter if checked)</font>
  <b><font color="#3A3966">EndIf</font></b>

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">GetGadgetItemState</font>(<font color="#924B72">#Listicon</font>, n) = <font color="#924B72">#PB_ListIcon_Checked</font> | <font color="#924B72">#PB_ListIcon_Selected</font>
    <font color="#3A3966">; Item n is checked AND selected</font>
  <b><font color="#3A3966">EndIf</font></b>

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">GetGadgetItemState</font>(<font color="#924B72">#Listicon</font>, n) &amp; <font color="#924B72">#PB_ListIcon_Checked</font> | <font color="#924B72">#PB_ListIcon_Selected</font>
    <font color="#3A3966">; Item n is checked OR selected OR both</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="setgadgetitemstate.html">SetGadgetItemState()</a>, <a href="getgadgetstate.html">GetGadgetState()</a>, <a href="setgadgetstate.html">SetGadgetState()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=getgadgetitemdata.html>GetGadgetItemData()</a> - <a href="index.html">Gadget Index</a> - <a href="getgadgetitemtext.html">GetGadgetItemText()</a> -><br><br>

</body></html>